<?php

namespace app\controllers;

use app\lib\AppController;
use app\models\ExerciseRecordModel;
use Yii;

class ExerciseRecordController extends AppController
{
    public function actionCreate(){
        $param = Yii::$app->getRequest()->getBodyParams();
        $leaveMsgModel = new ExerciseRecordModel();
        $leaveMsgModel->load($param,'');
        if($leaveMsgModel->save()){
            return [
                'code'=>0,
                'data'=>$leaveMsgModel
            ];
        }else{
            return [
                'code'=>1,
                'massage'=>'保存失败',
                'data'=>[]
            ];
        }
    }
    public function actionList(){
        $data = ExerciseRecordModel::find()->all();
        return [
            'code'=>0,
            'data'=>$data
        ];
    }
}
